
#ifndef   __IO__LPC2368__H_
#define   __IO__LPC2368__H_


typedef struct _IO_PORT
{
		unsigned PIN_0		:	1;
		unsigned PIN_1		:	1;
		unsigned PIN_2		:	1;
		unsigned PIN_3		:	1;
		unsigned PIN_4		:	1;
		unsigned PIN_5		:	1;
		unsigned PIN_6		:	1;
		unsigned PIN_7		:	1;
		unsigned PIN_8		:	1;
		unsigned PIN_9		:	1;
		unsigned PIN_10	:	1;
		unsigned PIN_11	:	1;
		unsigned PIN_12	:	1;
		unsigned PIN_13	:	1;
		unsigned PIN_14	:	1;
		unsigned PIN_15	:	1;
		unsigned PIN_16	:	1;
		unsigned PIN_17	:	1;
		unsigned PIN_18	:	1;
		unsigned PIN_19	:	1;
		unsigned PIN_20	:	1;
		unsigned PIN_21	:	1;
		unsigned PIN_22	:	1;
		unsigned PIN_23	:	1;
		unsigned PIN_24	:	1;
		unsigned PIN_25	:	1;
		unsigned PIN_26	:	1;
		unsigned PIN_27	:	1;
		unsigned PIN_28	:	1;
		unsigned PIN_29	:	1;
		unsigned PIN_30	:	1;
		unsigned PIN_31	:	1;
		
}IO_PORT;


#define 	PORT_0_DIR        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x00))
#define 	PORT_0_PIN        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x14))

#define 	PORT_1_DIR        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x20))
#define 	PORT_1_PIN        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x34))

#define 	PORT_2_DIR        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x40))
#define 	PORT_2_PIN        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x54))

#define 	PORT_3_DIR        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x60))
#define 	PORT_3_PIN        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x74))

#define 	PORT_4_DIR        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x80))
#define 	PORT_4_PIN        (*(volatile IO_PORT*)(FIO_BASE_ADDR + 0x94))


#define	PIN_INPUT		0
#define  PIN_OUTPUT		1

#define   PIN_EVENT__NO		0
#define   PIN_EVENT__UP		1
#define   PIN_EVENT__DOWN	2

#define   PIN_STATE_LO		0
#define   PIN_STATE_HI		1

#endif
